﻿using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
using YArchitech.Controls;
using YArchitech.DataModel;
using YArchitech.LIB;

namespace YArchitech.HVAC
{
	public partial class LayRadiatorWindowForms : System.Windows.Forms.Form
	{
		public LayRadiatorWindowForms()
		{
			this.InitializeComponent();
		}

		public LayRadiatorWindowForms(UserSetting userSetting)
		{
			this.InitializeComponent();
		}

		private void LayRadiatorWindowForms_Load(object sender, EventArgs e)
		{
			this.LaySettingInit();
		}

		private void LaySettingWrite()
		{
			this.userSettingS.WriteRadiatorText(this.hytbDistance.Text.Trim());
		}

		private void LaySettingInit()
		{
			this.hytbDistance.Text = this.userSettingS.GetRadiatorText();
		}

		private void btnOk_Click(object sender, EventArgs e)
		{
			this.layWindowParameter.Distance = Convert.ToDouble(this.hytbDistance.Text.Trim());
			this.LaySettingWrite();
			base.DialogResult = DialogResult.OK;
		}

		private void btnCancel_Click(object sender, EventArgs e)
		{
			base.DialogResult = DialogResult.Cancel;
		}

		private HVACUserSetting userSettingS = new HVACUserSetting();

		public LayWindowParameter layWindowParameter = new LayWindowParameter();
	}
}
